-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
add rustc option -Zpacked-stack #152432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add rustc option -Zpacked-stack #152432
Conversation
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
I'll add tests for assembly output and for target incompatibility. |
This comment has been minimized.
This comment has been minimized.
|
|
||
| fn packed_stack_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll Attribute> { | ||
| if sess.target.arch != Arch::S390x { | ||
| return None; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe panic here given that the frontend should already have emitted an error.
this enables packed-stack just as -mpacked-stack in clang and gcc. packed-stack is needed on s390x for kernel development.
5ddcabb to
4ebec9d
Compare
| return Err(format!( | ||
| "Enabling both `packed-stack` and `backchain` attributes is incompatible with the default s390x target. Switch to s390x-unknown-none-softfloat if you need both attributes." | ||
| )); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only checks the default-enabled features but ignores -Ctarget-features, so this check is largely ineffective. Also it checks for the packed-stack target feature which doesn't exist! Please add a test to confirm this, then move the check to a better place where it actually works.
| if sess.opts.unstable_opts.packed_stack { | ||
| if sess.target.arch != Arch::S390x { | ||
| sess.dcx().emit_err(errors::UnsupportedPackedStack); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like the most reasonable place to check the backchain condition?
| If not specified, overflow checks are enabled if | ||
| [debug-assertions](#debug-assertions) are enabled, disabled otherwise. | ||
|
|
||
| ## packed-stack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the option isn't stable yet, this is the wrong place to document it I think?
this enables
-Zpacked-stackjust as-mpacked-stackin clang and gcc. packed-stack is needed on s390x for kernel development.For reference: #151154 and #150766
look at @uweigand s post for full explanation of what this does. Here a wrap-up:
#150766 (comment)